package com.qys.livesMall.product.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qys.livesMall.product.entity.H2ProductSku;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author gmx
 * @since 2023-05-17
 */
public interface H2ProductSkuMapper extends BaseMapper<H2ProductSku> {
    int decount(@Param("id") Long skuId, @Param("num") Integer num);

    @Select("SELECT SUM(price) AS total_price FROM h2_product_sku WHERE spu_id=#{spuId} GROUP BY spu_id")
    BigDecimal sumPriceBySpuId(@Param("spuId") String spuId);


}
